package com.viewpagertext.activitys;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;

import android.os.Bundle;

import com.viewpagertext.R;
import com.viewpagertext.adapters.PlayFragmentPagerAdapter;
import com.viewpagertext.adapters.SearchFragmentPagerAdapter;
import com.viewpagertext.databinding.ActivityPlayBinding;
import com.viewpagertext.databinding.ActivitySearchBinding;
import com.viewpagertext.fragments.ListFragment;
import com.viewpagertext.fragments.SearchFragment;

import java.util.ArrayList;

public class SearchActivity extends AppCompatActivity {
    private Fragment mData;
    private ActivitySearchBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
        initView();//实例化控件
    }

    private void initView() {
        initDatas();
        SearchFragmentPagerAdapter playFragmentPagerAdapter = new SearchFragmentPagerAdapter(getSupportFragmentManager(), mData);
        binding.playViewpager.setAdapter(playFragmentPagerAdapter);
    }

    private void initDatas() {
        mData = new SearchFragment();
    }
}